package com.kuanter.kuanterauto.adapter;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.kuanter.kuanterauto.R;

/**
 * 汽车型号子项适配器
 * @author soup
 *
 */
public class ChildxhAdapter extends BaseAdapter{
	
	private ArrayList<String> childxh=null;
	private Context context=null;
	
	public ChildxhAdapter(Context context,ArrayList<String> childxh){
		this.childxh=childxh;
		this.context=context;
	}

	@Override
	public int getCount() {
		return childxh.size();
	}

	@Override
	public Object getItem(int position) {
		return childxh.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		Holder holder=null;
		if(convertView==null){
			holder=new Holder();
			convertView=LayoutInflater.from(context).inflate(R.layout.lv_childxh_item, null);
			holder.tv_pp=(TextView) convertView.findViewById(R.id.tv_pp);
			holder.rl_pp_x=(RelativeLayout) convertView.findViewById(R.id.rl_pp_x);
			
			convertView.setTag(holder);
		}else{
			holder=(Holder) convertView.getTag();
		}
		
		String str=childxh.get(position);
		if(str!=null&&!str.equals("")){
		holder.tv_pp.setText(childxh.get(position));
		}else{
			holder.tv_pp.setText("");
		}
		
		return convertView;
	}
	
	class Holder{
		TextView tv_pp;
		RelativeLayout rl_pp_x;
	}

}
